﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dbPoll_Application.ViewModels.SelectUserViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	SelectUser
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="../../Scripts/Poll-SelectUser.js"></script>

    <% String pageTitle;
       String buttonClass;
       if (Model.role.RoleName == "Poll Creator") {
          pageTitle = "Select Poll Creators";
          buttonClass = "addCreator";
       }
       else {
            pageTitle = "Select Poll Masters";
            buttonClass = "addMaster";
       } %>
    <div class="pageHeadingContainer"><h2 class="pageHeading"><%= pageTitle %></h2></div>
    <div id="contentContainer">
        <p>
           <%= Html.ActionLink("Polls > ", "Index", "Poll", null, new { @class = "breadcrumb" })%>
           <%= Html.ActionLink(Model.pollName + " > ", "Questions", "Poll", new { pollID = Model.pollID, pollName = Model.pollName }, new { @class = "breadcrumb" })%>
           Add <%= Model.role.RoleName %>
        </p>
        <input type="hidden" value="<%= Model.pollID %>" id="pollID" name="pollID" />
        <input type="hidden" value="<%= Model.pollName %>" id="pollName" name="pollName" />
        <div id="filterUsers"><label for="filter">Filter</label><input type="text" name="filter" id="filter" value="Enter a keyword to filter the list..." /></div>
        <table class="questions">
        <tr>
            <th class="selectUserHeader">User</th>
            <th class="selectUserHeader">Email</th>
            <th class="selectUserHeader">Firstname</th>
            <th class="selectUserHeader">Lastname</th>
            <th class="selectUserHeader">Organisation</th>
            <th class="selectUserHeader">Position</th>
            <th class="selectUserHeader">City</th>
            <th></th>
        </tr>
        <% foreach (var user in Model.users)
           { %>
           <tr class="selectUserItem">
               <td><%= user.UserName%></td>
               <td><%= user.Email%></td>
               <td><%= user.FirstName%></td>
               <td><%= user.LastName%></td>
               <td><%= user.Organisation%></td>
               <td><%= user.Position%></td>
               <td><%= user.City%></td>
               <td width='150px'><input type="button" value="Add" class="<%= buttonClass %>" />
               <img style="visibility:hidden" src="../../Resources/ajax-loader.gif" /></td>
           </tr>
        <% } %>
    </table>
    </div>

</asp:Content>
